package com.lxj.stream;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

/**
 * PracticeSteam
 */
public class PracticeSteam {
    public static void main(String[] args) {

        String file_path = "f:/xyz/abc/def/lol2.txt";
        File f = new File(file_path);

        try {
            FileOutputStream fos = new FileOutputStream(f);

            byte b[] = {88,87};
            fos.write(b);

            fos.close();

        } catch (FileNotFoundException fe) {
            System.out.println(f.isDirectory());
            if(!f.exists()) {
                System.out.println("not found");
                f.getParentFile().mkdirs();
            }
            System.out.println("exist");

            // f.getParentFile().mkdirs();
            // System.out.println(f.getParent());
            // System.out.println(f.getParentFile());
            // System.out.println(f.getPath());

            // System.out.println("file not found");
        } catch (Exception e) {
            e.printStackTrace();
            //TODO: handle exception
        }
    }
}